package com.topone.service.impl;

import com.topone.dataObject.CouponCode;
import com.topone.repository.CouponCodeRepository;
import com.topone.service.CouponCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class CouponCodeServiceImpl implements CouponCodeService {

    @Autowired
    private CouponCodeRepository couponCodeRepository;

    @Override
    public List<CouponCode> findOne(Integer status) {
        return couponCodeRepository.findByStatus(status);
    }

    @Override
    public void update(CouponCode couponCode) {
        couponCodeRepository.save(couponCode);
    }

    @Override
    public CouponCode findByCode(String code) {
        return couponCodeRepository.findByCode(code);
    }
}
